home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / examples / helpsigs / Printbase.sml < prev    next >
LaTeX Document  |  1997-08-18  |  2.3 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: Printbase.sml

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 28 2a 20 4f 75 74 70 75 | 74 74 69 6e 67 20 74 68 |(* Outpu|tting th|
|00000010| 65 20 68 65 6c 70 20 73 | 69 67 6e 61 74 75 72 65 |e help s|ignature|
|00000020| 20 64 61 74 61 62 61 73 | 65 20 69 6e 20 41 53 43 | databas|e in ASC|
|00000030| 49 49 2c 20 4c 61 54 65 | 58 20 61 6e 64 20 48 54 |II, LaTe|X and HT|
|00000040| 4d 4c 20 66 6f 72 6d 61 | 74 20 2a 29 0d 0d 66 75 |ML forma|t *)..fu|
|00000050| 6e 20 70 72 69 6e 74 41 | 53 43 49 49 42 61 73 65 |n printA|SCIIBase|
|00000060| 28 73 69 67 66 69 6c 65 | 2c 20 6f 75 74 66 69 6c |(sigfile|, outfil|
|00000070| 65 29 20 3d 0d 20 20 20 | 20 6c 65 74 20 66 75 6e |e) =. | let fun|
|00000080| 20 70 72 74 73 65 71 20 | 28 70 72 2c 20 73 65 70 | prtseq |(pr, sep|
|00000090| 29 20 5b 5d 20 20 20 20 | 20 20 3d 20 22 22 0d 09 |) [] | = ""..|
|000000a0| 20 20 7c 20 70 72 74 73 | 65 71 20 28 70 72 2c 20 | | prts|eq (pr, |
|000000b0| 73 65 70 29 20 5b 78 5d | 20 20 20 20 20 3d 20 70 |sep) [x]| = p|
|000000c0| 72 20 78 0d 09 20 20 7c | 20 70 72 74 73 65 71 20 |r x.. || prtseq |
|000000d0| 28 70 72 2c 20 73 65 70 | 29 20 28 78 3a 3a 78 73 |(pr, sep|) (x::xs|
|000000e0| 29 20 3d 20 70 72 20 78 | 20 5e 20 73 65 70 20 5e |) = pr x| ^ sep ^|
|000000f0| 20 70 72 74 73 65 71 28 | 70 72 2c 20 73 65 70 29 | prtseq(|pr, sep)|
|00000100| 20 78 73 0d 09 0d 09 6f | 70 65 6e 20 44 61 74 61 | xs....o|pen Data|
|00000110| 62 61 73 65 0d 09 76 61 | 6c 20 64 62 20 3d 20 72 |base..va|l db = r|
|00000120| 65 61 64 62 61 73 65 20 | 73 69 67 66 69 6c 65 0d |eadbase |sigfile.|
|00000130| 09 76 61 6c 20 6f 73 20 | 3d 20 54 65 78 74 49 4f |.val os |= TextIO|
|00000140| 2e 6f 70 65 6e 4f 75 74 | 20 6f 75 74 66 69 6c 65 |.openOut| outfile|
|00000150| 0d 09 66 75 6e 20 6f 75 | 74 20 73 20 3d 20 54 65 |..fun ou|t s = Te|
|00000160| 78 74 49 4f 2e 6f 75 74 | 70 75 74 28 6f 73 2c 20 |xtIO.out|put(os, |
|00000170| 73 29 0d 09 66 75 6e 20 | 70 72 65 6e 74 72 79 20 |s)..fun |prentry |
|00000180| 7b 63 6f 6d 70 2c 20 73 | 74 72 2c 20 6c 69 6e 65 |{comp, s|tr, line|
|00000190| 7d 20 3d 0d 09 20 20 20 | 20 6c 65 74 20 66 75 6e |} =.. | let fun|
|000001a0| 20 6d 6b 69 74 65 6d 20 | 6b 69 6e 64 20 69 64 20 | mkitem |kind id |
|000001b0| 3d 20 0d 09 09 63 6f 6e | 63 61 74 5b 6b 69 6e 64 |= ...con|cat[kind|
|000001c0| 2c 20 22 20 22 2c 20 69 | 64 2c 20 22 20 28 22 2c |, " ", i|d, " (",|
|000001d0| 20 73 74 72 2c 20 22 20 | 22 2c 20 49 6e 74 2e 74 | str, " |", Int.t|
|000001e0| 6f 53 74 72 69 6e 67 20 | 6c 69 6e 65 2c 20 22 29 |oString |line, ")|
|000001f0| 22 5d 0d 09 20 20 20 20 | 69 6e 0d 09 09 63 61 73 |"].. |in...cas|
|00000200| 65 20 63 6f 6d 70 20 6f | 66 0d 09 09 20 20 20 20 |e comp o|f... |
|00000210| 53 74 72 20 20 20 20 3d | 3e 20 22 73 74 72 75 63 |Str =|> "struc|
|00000220| 74 75 72 65 20 22 20 5e | 20 73 74 72 0d 09 09 20 |ture " ^| str... |
|00000230| 20 7c 20 45 78 63 20 69 | 64 20 3d 3e 20 6d 6b 69 | | Exc i|d => mki|
|00000240| 74 65 6d 20 22 65 78 63 | 65 70 74 69 6f 6e 22 20 |tem "exc|eption" |
|00000250| 69 64 0d 09 09 20 20 7c | 20 54 79 70 20 69 64 20 |id... || Typ id |
|00000260| 3d 3e 20 6d 6b 69 74 65 | 6d 20 22 74 79 70 65 22 |=> mkite|m "type"|
|00000270| 20 69 64 0d 09 09 20 20 | 7c 20 56 61 6c 20 69 64 | id... || Val id|
|00000280| 20 3d 3e 20 6d 6b 69 74 | 65 6d 20 22 76 61 6c 75 | => mkit|em "valu|
|00000290| 65 22 20 69 64 0d 09 09 | 20 20 7c 20 43 6f 6e 20 |e" id...| | Con |
|000002a0| 69 64 20 3d 3e 20 6d 6b | 69 74 65 6d 20 22 63 6f |id => mk|item "co|
|000002b0| 6e 73 74 72 75 63 74 6f | 72 22 20 69 64 0d 09 20 |nstructo|r" id.. |
|000002c0| 20 20 20 65 6e 64 0d 09 | 66 75 6e 20 70 72 74 72 | end..|fun prtr|
|000002d0| 65 65 20 45 6d 70 74 79 | 20 3d 20 28 29 0d 09 20 |ee Empty| = ().. |
|000002e0| 20 7c 20 70 72 74 72 65 | 65 20 28 4e 6f 64 65 28 | | prtre|e (Node(|
|000002f0| 6b 65 79 2c 20 65 6e 74 | 72 69 65 73 2c 20 74 31 |key, ent|ries, t1|
|00000300| 2c 20 74 32 29 29 20 3d | 20 0d 09 20 20 20 20 28 |, t2)) =| .. (|
|00000310| 70 72 74 72 65 65 20 74 | 31 3b 0d 09 20 20 20 20 |prtree t|1;.. |
|00000320| 20 6f 75 74 20 28 70 72 | 74 73 65 71 20 28 70 72 | out (pr|tseq (pr|
|00000330| 65 6e 74 72 79 2c 20 22 | 2c 20 22 29 20 65 6e 74 |entry, "|, ") ent|
|00000340| 72 69 65 73 29 3b 0d 09 | 20 20 20 20 20 6f 75 74 |ries);..| out|
|00000350| 20 22 5c 6e 22 3b 0d 09 | 20 20 20 20 20 70 72 74 | "\n";..| prt|
|00000360| 72 65 65 20 74 32 29 0d | 20 20 20 20 69 6e 20 70 |ree t2).| in p|
|00000370| 72 74 72 65 65 20 64 62 | 3b 20 54 65 78 74 49 4f |rtree db|; TextIO|
|00000380| 2e 63 6c 6f 73 65 4f 75 | 74 20 6f 73 20 65 6e 64 |.closeOu|t os end|
|00000390| 0d 0d 66 75 6e 20 70 72 | 69 6e 74 4c 61 74 65 78 |..fun pr|intLatex|
|000003a0| 42 61 73 65 28 73 69 67 | 66 69 6c 65 2c 20 6f 75 |Base(sig|file, ou|
|000003b0| 74 66 69 6c 65 29 20 3d | 0d 20 20 20 20 6c 65 74 |tfile) =|. let|
|000003c0| 20 6f 70 65 6e 20 44 61 | 74 61 62 61 73 65 0d 09 | open Da|tabase..|
|000003d0| 76 61 6c 20 64 62 20 3d | 20 72 65 61 64 62 61 73 |val db =| readbas|
|000003e0| 65 20 73 69 67 66 69 6c | 65 0d 09 76 61 6c 20 6f |e sigfil|e..val o|
|000003f0| 73 20 3d 20 54 65 78 74 | 49 4f 2e 6f 70 65 6e 4f |s = Text|IO.openO|
|00000400| 75 74 20 6f 75 74 66 69 | 6c 65 0d 09 66 75 6e 20 |ut outfi|le..fun |
|00000410| 6f 75 74 20 73 20 3d 20 | 54 65 78 74 49 4f 2e 6f |out s = |TextIO.o|
|00000420| 75 74 70 75 74 28 6f 73 | 2c 20 73 29 0d 09 66 75 |utput(os|, s)..fu|
|00000430| 6e 20 74 74 20 73 20 3d | 20 22 5c 5c 76 65 72 62 |n tt s =| "\\verb|
|00000440| 23 22 20 5e 20 73 20 5e | 20 22 23 22 0d 0d 09 28 |#" ^ s ^| "#"...(|
|00000450| 2a 20 49 6e 73 65 72 74 | 20 65 78 74 72 61 20 76 |* Insert| extra v|
|00000460| 65 72 74 69 63 61 6c 20 | 73 70 61 63 65 20 77 68 |ertical |space wh|
|00000470| 65 6e 20 6d 65 65 74 69 | 6e 67 20 61 20 6e 65 77 |en meeti|ng a new|
|00000480| 20 69 6e 69 74 69 61 6c | 20 6c 65 74 74 65 72 20 | initial| letter |
|00000490| 2a 29 0d 09 76 61 6c 20 | 6c 61 73 74 63 31 20 3d |*)..val |lastc1 =|
|000004a0| 20 72 65 66 20 23 22 20 | 22 0d 09 66 75 6e 20 73 | ref #" |"..fun s|
|000004b0| 65 70 61 72 61 74 6f 72 | 20 6b 31 20 3d 20 0d 09 |eparator| k1 = ..|
|000004c0| 20 20 20 20 6c 65 74 20 | 76 61 6c 20 63 31 20 3d | let |val c1 =|
|000004d0| 20 43 68 61 72 2e 74 6f | 4c 6f 77 65 72 20 6b 31 | Char.to|Lower k1|
|000004e0| 0d 09 20 20 20 20 69 6e | 20 0d 09 09 69 66 20 43 |.. in| ...if C|
|000004f0| 68 61 72 2e 69 73 41 6c | 70 68 61 20 63 31 20 61 |har.isAl|pha c1 a|
|00000500| 6e 64 61 6c 73 6f 20 63 | 31 20 3c 3e 20 21 6c 61 |ndalso c|1 <> !la|
|00000510| 73 74 63 31 20 74 68 65 | 6e 20 0d 09 09 20 20 20 |stc1 the|n ... |
|00000520| 20 28 6c 61 73 74 63 31 | 20 3a 3d 20 63 31 3b 0d | (lastc1| := c1;.|
|00000530| 09 09 20 20 20 20 20 6f | 75 74 20 22 5c 5c 5c 5c |.. o|ut "\\\\|
|00000540| 5b 32 65 78 5d 5c 6e 5c | 6e 22 29 0d 09 20 20 20 |[2ex]\n\|n").. |
|00000550| 20 20 20 20 65 6c 73 65 | 20 28 29 0d 09 20 20 20 | else| ().. |
|00000560| 20 65 6e 64 0d 09 66 75 | 6e 20 6e 65 78 74 73 74 | end..fu|n nextst|
|00000570| 72 20 6c 61 73 74 20 5b | 5d 20 20 20 20 20 20 20 |r last [|] |
|00000580| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000590| 20 20 20 20 20 20 20 20 | 20 20 20 3d 20 6f 75 74 | | = out|
|000005a0| 20 22 29 5c 6e 22 0d 09 | 20 20 7c 20 6e 65 78 74 | ")\n"..| | next|
|000005b0| 73 74 72 20 6c 61 73 74 | 20 28 28 65 31 20 61 73 |str last| ((e1 as|
|000005c0| 20 7b 63 6f 6d 70 2c 20 | 73 74 72 2c 20 2e 2e 2e | {comp, |str, ...|
|000005d0| 7d 29 20 3a 3a 20 65 72 | 65 73 74 29 20 3d 0d 09 |}) :: er|est) =..|
|000005e0| 20 20 20 20 69 66 20 63 | 6f 6d 70 20 3d 20 6c 61 | if c|omp = la|
|000005f0| 73 74 20 74 68 65 6e 0d | 09 09 28 6f 75 74 20 22 |st then.|..(out "|
|00000600| 2c 20 22 3b 20 6f 75 74 | 20 28 74 74 20 73 74 72 |, "; out| (tt str|
|00000610| 29 3b 20 6e 65 78 74 73 | 74 72 20 6c 61 73 74 20 |); nexts|tr last |
|00000620| 65 72 65 73 74 29 0d 09 | 20 20 20 20 65 6c 73 65 |erest)..| else|
|00000630| 20 0d 09 09 28 6f 75 74 | 20 22 29 5c 6e 22 3b 20 | ...(out| ")\n"; |
|00000640| 6e 65 77 69 74 65 6d 20 | 65 31 20 65 72 65 73 74 |newitem |e1 erest|
|00000650| 29 0d 09 61 6e 64 20 6e | 65 77 69 74 65 6d 20 28 |)..and n|ewitem (|
|00000660| 65 31 20 61 73 20 7b 63 | 6f 6d 70 2c 20 73 74 72 |e1 as {c|omp, str|
|00000670| 2c 20 2e 2e 2e 7d 29 20 | 65 72 65 73 74 20 3d 0d |, ...}) |erest =.|
|00000680| 09 20 20 20 20 6c 65 74 | 20 76 61 6c 20 6b 65 79 |. let| val key|
|00000690| 20 3d 20 44 61 74 61 62 | 61 73 65 2e 67 65 74 6e | = Datab|ase.getn|
|000006a0| 61 6d 65 20 65 31 0d 09 | 20 20 20 20 69 6e 20 0d |ame e1..| in .|
|000006b0| 09 09 28 73 65 70 61 72 | 61 74 6f 72 20 28 53 74 |..(separ|ator (St|
|000006c0| 72 69 6e 67 2e 73 75 62 | 28 6b 65 79 2c 20 30 29 |ring.sub|(key, 0)|
|000006d0| 29 3b 0d 09 09 20 6f 75 | 74 20 22 5c 5c 69 74 65 |);... ou|t "\\ite|
|000006e0| 6d 5b 5d 20 22 3b 20 6f | 75 74 20 28 74 74 20 6b |m[] "; o|ut (tt k|
|000006f0| 65 79 29 3b 20 6f 75 74 | 20 22 20 28 22 3b 0d 09 |ey); out| " (";..|
|00000700| 09 20 6f 75 74 20 28 63 | 61 73 65 20 63 6f 6d 70 |. out (c|ase comp|
|00000710| 20 6f 66 0d 09 09 09 20 | 20 53 74 72 20 3d 3e 20 | of.... | Str => |
|00000720| 22 73 74 72 75 63 74 75 | 72 65 22 0d 09 09 09 7c |"structu|re"....||
|00000730| 20 56 61 6c 20 69 64 20 | 3d 3e 20 22 76 61 6c 75 | Val id |=> "valu|
|00000740| 65 3b 20 22 20 5e 20 74 | 74 20 73 74 72 0d 09 09 |e; " ^ t|t str...|
|00000750| 09 7c 20 54 79 70 20 69 | 64 20 3d 3e 20 22 74 79 |.| Typ i|d => "ty|
|00000760| 70 65 3b 20 22 20 5e 20 | 74 74 20 73 74 72 0d 09 |pe; " ^ |tt str..|
|00000770| 09 09 7c 20 45 78 63 20 | 69 64 20 3d 3e 20 22 65 |..| Exc |id => "e|
|00000780| 78 63 65 70 74 69 6f 6e | 3b 20 22 20 5e 20 74 74 |xception|; " ^ tt|
|00000790| 20 73 74 72 0d 09 09 09 | 7c 20 43 6f 6e 20 69 64 | str....|| Con id|
|000007a0| 20 3d 3e 20 22 63 6f 6e | 73 74 72 75 63 74 6f 72 | => "con|structor|
|000007b0| 3b 20 22 20 5e 20 74 74 | 20 73 74 72 29 3b 0d 09 |; " ^ tt| str);..|
|000007c0| 09 20 6e 65 78 74 73 74 | 72 20 63 6f 6d 70 20 65 |. nextst|r comp e|
|000007d0| 72 65 73 74 29 0d 09 20 | 20 20 20 65 6e 64 0d 09 |rest).. | end..|
|000007e0| 66 75 6e 20 70 72 65 6e | 74 72 69 65 73 20 5b 5d |fun pren|tries []|
|000007f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 3d 20 28 29 | | = ()|
|00000800| 0d 09 20 20 7c 20 70 72 | 65 6e 74 72 69 65 73 20 |.. | pr|entries |
|00000810| 28 65 31 20 3a 3a 20 65 | 72 65 73 74 29 20 3d 20 |(e1 :: e|rest) = |
|00000820| 6e 65 77 69 74 65 6d 20 | 65 31 20 65 72 65 73 74 |newitem |e1 erest|
|00000830| 0d 09 66 75 6e 20 70 72 | 74 72 65 65 20 45 6d 70 |..fun pr|tree Emp|
|00000840| 74 79 20 3d 20 28 29 0d | 09 20 20 7c 20 70 72 74 |ty = ().|. | prt|
|00000850| 72 65 65 20 28 4e 6f 64 | 65 28 6b 65 79 2c 20 65 |ree (Nod|e(key, e|
|00000860| 6e 74 72 69 65 73 2c 20 | 74 31 2c 20 74 32 29 29 |ntries, |t1, t2))|
|00000870| 20 3d 20 0d 09 20 20 20 | 20 28 70 72 74 72 65 65 | = .. | (prtree|
|00000880| 20 74 31 3b 0d 09 20 20 | 20 20 20 70 72 65 6e 74 | t1;.. | prent|
|00000890| 72 69 65 73 20 65 6e 74 | 72 69 65 73 3b 0d 09 20 |ries ent|ries;.. |
|000008a0| 20 20 20 20 70 72 74 72 | 65 65 20 74 32 29 0d 20 | prtr|ee t2). |
|000008b0| 20 20 20 69 6e 20 0d 09 | 6f 75 74 20 22 5c 5c 62 | in ..|out "\\b|
|000008c0| 65 67 69 6e 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |egin{des|cription|
|000008d0| 7d 5c 5c 73 6d 61 6c 6c | 5c 6e 22 3b 0d 09 70 72 |}\\small|\n";..pr|
|000008e0| 74 72 65 65 20 64 62 3b | 20 0d 09 6f 75 74 20 22 |tree db;| ..out "|
|000008f0| 5c 5c 65 6e 64 7b 64 65 | 73 63 72 69 70 74 69 6f |\\end{de|scriptio|
|00000900| 6e 7d 5c 6e 22 3b 0d 09 | 54 65 78 74 49 4f 2e 63 |n}\n";..|TextIO.c|
|00000910| 6c 6f 73 65 4f 75 74 20 | 6f 73 20 0d 20 20 20 20 |loseOut |os . |
|00000920| 65 6e 64 0d | |end. | |
+--------+-------------------------+-------------------------+--------+--------+